<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"  prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>资料库</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/timeago.js"></script>
</head>
<body>
	<%@include file="include/topbar.jsp" %>

	<div class="container" style="margin-top: 60px">
			<div class="row">
				<jsp:include page="include/left.jsp">
					<jsp:param value="document" name="tag"/>
				
				</jsp:include>
								<div class="modal fade" id="delalert">
								    <div class="modal-header">
								    	<a class="close" data-dismiss="modal">×</a>
								    <h3>系统提示</h3>
								    </div>
								    <div class="modal-body">
								   		<p style="text-align:center">确定要删除么？</p>
								    </div>
								    <div class="modal-footer">
								    <a href="#" class="btn" data-dismiss="modal">返回</a>
								    <a href="javascript:;" title="删除" class="btn btn-primary"id="btn-del" data-dismiss="modal">确认删除</a>
								    </div>
								</div>

			<div class="span9">
				<ul class="breadcrumb wall" style="margin-bottom:0px;border-radius:3px 3px 0 0">
        			<h4 style="display:inline"><li><i class="icon-folder-open"></i>&nbsp;资料库</li></h4>
        			<li class="pull-right"><a href="adddocument.jspx" ><i class="icon-plus"></i>分享新资料</a></li>
     			</ul>
     			<div class="wall" style="padding:20px;border-radius:0 0 3px 3px">
     				
				<c:if test="${empty documentlist }">
					<p style="text-align:center">暂时没有资料！</p>
				</c:if>
				
				<c:if test="${! empty documentlist  }">
				<c:forEach items="${documentlist }" var="document">
					<blockquote id="${document.id}">
     					<h4>
     						<a href="editdocument.jspx?m=detail&did=${document.id } ">${document.title }</a>
     						<c:if test="${document.empId eq employee.id }">
     						<span class="pull-right">
     							<a href="editdocument.jspx?m=edit&did=${document.id }" title="编辑" ><i class="icon-edit"></i></a>

     							<a href="#delalert" rel="${document.id}" data-toggle="modal"><i class="icon-trash"></i></a>
     							
     							

     						</span>
     						</c:if>
     					</h4>
     					<p style="font-size:14px;overflow:hidden;text-indent:2em">${fn:substring(document.content ,0,96)} </p>
     					<small >${document.empName }发表于<abbr class="timeago" title="${document.createTime}">${document.createTime}</abbr></small>
     					
     				</blockquote>
					
			
				</c:forEach>
     			</c:if>	
     			</div>

			</div>
	</div>
	</div>
		
	<script type="text/javascript">
		$(document).ready(function(){
			$("abbr.timeago").timeago();
				var did;
			$("a[rel]").click(function(){
				did = $(this).attr("rel");
			
			});
			
			$("#btn-del").click(function(){
				$.ajax({
					url:"editdocument.jspx",
					type:"GET",
					data:{m:"delete",did:did},
					success:function(){
						$("#"+did).remove();
					}
				});
			});
		});
	</script>
</body>
</html>